import { Button, Space } from "antd";
import { useComponetsStore } from "../../store/components";
import classNames from "classnames";

export default function Header() {
	const { mode, setMode, setCurComponentId } = useComponetsStore();
	return (
		<div className={classNames("flexContainer" , "jsSB")} style={{width:"100%"}}>
            <span>
                低代码平台
            </span>
			<Space>
				{mode === "edit" && (
					<Button
						onClick={() => {
							setMode("preview");
							setCurComponentId(null);
						}}
						type="primary"
					>
						预览
					</Button>
				)}
				{mode === "preview" && (
					<Button
						onClick={() => {
							setMode("edit");
						}}
						type="primary"
					>
						退出预览
					</Button>
				)}
			</Space>
		</div>
	);
}
